import json
import os


class Config:
    def __init__(self, env):
        config_file = os.path.join(os.path.dirname(__file__), '..', 'config', f'{env}.json')
        print(config_file)
        with open(config_file) as f:
            self.config = json.load(f)

    def get(self, key, default=None):
        return self.config.get(key, default)

    def get_by_sub_key(self, key, sub_key, default=None):
        return self.config.get(key).get(sub_key, default)